import os
from openai import OpenAI
# from langchain_openai import ChatOpenAI
# 初始化客户端（阿里云百炼）


def get_client():
    client = OpenAI(
        api_key="sk-965dc39b016c49ecbe29de180f4db2b6",  # 您的API Key
        base_url="https://dashscope.aliyuncs.com/compatible-mode/v1"  # 阿里云百炼端点
    )
    return client

def oa(template:str) -> str:
    client = get_client()
    client.images.generate("")
    completion = client.chat.completions.create(
        model="qwen-plus",  # 指定模型
        messages=[
            {'role': 'system', 'content': f'{template}'},
            {'role': 'user', 'content': '你是谁？'}
        ],
        stream=False  # 非流式输出
    )

    print(completion.choices[0].message.content)

